home *** CD-ROM | disk | FTP | other *** search
/ Building Homes of Our Own / Building Homes of our Own.iso / setup / data1.cab / Everything / working / houCons.dxr / interface_237_windowClickTracker behave.ls < prev    next >
Encoding:
Text File  |  2002-09-25  |  1.8 KB  |  79 lines

  1. property mySprite, myRect, myLoc, lastRoll, myType, HLinesList, targetSprite
  2.  
  3. on beginSprite me
  4.   global gActorListMan
  5.   mySprite = me.spriteNum
  6.   myRect = rect(93, 564, 258, 586)
  7.   setUpRegions(me)
  8.   myType = #windowClickTracker
  9.   registerSprite(gActorListMan, mySprite)
  10. end
  11.  
  12. on endSprite me
  13.   global gActorListMan
  14.   unRegisterSprite(gActorListMan, mySprite)
  15. end
  16.  
  17. on stepFrame me
  18.   global gCursorMan, gClickSprite
  19.   if voidp(targetSprite) then
  20.     targetSprite = sendAllSprites(#sendSpriteNum, #FloorPlanDisplay)
  21.   end if
  22.   thisRoll = rollover()
  23.   if thisRoll = mySprite then
  24.     setCursor(gCursorMan, #handNormal, myType)
  25.     if (lastRoll <> mySprite) and not (the mouseDown) then
  26.       lastRoll = mySprite
  27.       exit
  28.     end if
  29.     if (gClickSprite = mySprite) and the mouseDown then
  30.       lastRoll = me.mySprite
  31.       setCursor(gCursorMan, #handNormal, myType)
  32.       exit
  33.     end if
  34.   else
  35.     if lastRoll = mySprite then
  36.       lastRoll = 0
  37.       setCursor(gCursorMan, #Arrow, myType)
  38.     end if
  39.   end if
  40. end
  41.  
  42. on mouseDown me
  43.   global gClickSprite
  44.   if resWindowUp() or modalWindowUp() then
  45.     exit
  46.   end if
  47.   gClickSprite = mySprite
  48.   if voidp(targetSprite) then
  49.     targetSprite = sendAllSprites(#sendSpriteNum, #FloorPlanDisplay)
  50.   end if
  51.   clickLoc = the clickLoc
  52.   ClickH = clickLoc[1]
  53.   if ClickH < HLinesList[1] then
  54.     whichAction = 1
  55.   else
  56.     if ClickH < HLinesList[2] then
  57.       whichAction = 2
  58.     else
  59.       if ClickH < HLinesList[3] then
  60.         whichAction = 3
  61.       else
  62.         whichAction = 4
  63.       end if
  64.     end if
  65.   end if
  66.   put whichAction
  67.   doButtonUpClick(myType, 1)
  68.   sendSprite(targetSprite, #setDisplay, whichAction)
  69. end
  70.  
  71. on setUpRegions me
  72.   HLinesList = []
  73.   myWidth = myRect[3] - myRect[1]
  74.   inc = myWidth / 4
  75.   append(HLinesList, myRect[1] + inc)
  76.   append(HLinesList, myRect[1] + (inc * 2))
  77.   append(HLinesList, myRect[1] + (inc * 3))
  78. end
  79.